<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="https://www.thymeleaf.org"
      xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity3" lang="en">
    <head>
        <title>Spring Security示例</title>
        <meta charset="utf-8" />
        <link rel="stylesheet" th:href="@{/css/main.css}" />
    </head>
    <body>
        <div th:fragment="logout" sec:authorize="isAuthenticated()" style="background-color: antiquewhite">
            登录用户: <span sec:authentication="name"></span> |
            角色: <span sec:authentication="principal.authorities"></span>
            <div>
                <form action="#" th:action="@{/logout}" method="post">
                    <input type="submit" value="Logout" />
                </form>
            </div>
        </div>
        <div style="background-color: bisque">
            <h1>Spring Security示例</h1>
            <p>当前页面是不安全的，你可以通过登录之后访问安全的页面。</p>
            <ul>
                <li>访问<a th:href="@{/user/index}">安全的页面</a></li>
                <li>访问<a th:href="@{/admin/api/hello}">访问/admin/api/hello</a></li>
                <li>访问<a th:href="@{/user/api/hello}">访问/user/api/hello</a></li>
                <li>访问<a th:href="@{/createUserPage}">创建用户页面</a></li>
            </ul>
        </div>
    </body>
</html>
